import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import get from '@dfeidao/atom-web/local/get';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import refresh from '@dfeidao/atom-web/url/refresh';
export default async function a003(fd: IFeidaoAiBrowserComponent) {
	// todo
	// 修改计划分类弹窗
	const ov = get(fd, "optional_value");// 值名称
	console.log(ov);

	const vd = get(fd, "value_description");// 值描述
	console.log(vd);

	// 修改后数据
	const optional_value = fd.data.node.querySelector<HTMLInputElement>('[data-id="optional_value"]');
	const ovv = optional_value.value;
	console.log(ovv);
	const value_description = fd.data.node.querySelector<HTMLInputElement>('[data-id="value_description"]');
	const vd1 = value_description.value;

	if (ovv === "") {
		alert("请输入完整数据");
	} else {
		const r = await nodejs<{ code: 0 | 1 }>('basic-data-wzz/zj-000003/s001', {
			data: {
				optional_value: ovv,
				value_description: vd1
			}
		});
		console.log(r);
		if (r.code === 1) {
			alert("修改成功");
			refresh();
		}
	}
}
